<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
            padding: 20px;
        }

        .login-container {
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
            padding: 40px;
            width: 100%;
            max-width: 450px;
            transition: transform 0.3s ease;
        }

        .login-container:hover {
            transform: translateY(-5px);
        }

        .login-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .login-header h1 {
            color: #333;
            font-size: 2.5rem;
            margin-bottom: 10px;
            background: linear-gradient(90deg, #6a11cb, #2575fc);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .login-header p {
            color: #666;
            font-size: 1.1rem;
        }

        .input-group {
            position: relative;
            margin-bottom: 25px;
        }

        .input-group i {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #777;
            font-size: 18px;
        }

        .input-group input {
            width: 100%;
            padding: 15px 15px 15px 45px;
            border: 2px solid #e1e1e1;
            border-radius: 12px;
            font-size: 16px;
            transition: all 0.3s ease;
            outline: none;
            background: #f9f9f9;
        }

        .input-group input:focus {
            border-color: #6a11cb;
            background: #fff;
            box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.1);
        }

        .input-group input::placeholder {
            color: #aaa;
        }

        .remember-forgot {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
            font-size: 14px;
        }

        .remember-me {
            display: flex;
            align-items: center;
        }

        .remember-me input {
            margin-right: 8px;
        }

        .forgot-password {
            color: #6a11cb;
            text-decoration: none;
            transition: color 0.3s;
        }

        .forgot-password:hover {
            color: #2575fc;
            text-decoration: underline;
        }

        .btn-login {
            width: 100%;
            padding: 15px;
            border: none;
            border-radius: 12px;
            background: linear-gradient(90deg, #6a11cb, #2575fc);
            color: white;
            font-size: 18px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 5px 15px rgba(106, 17, 203, 0.3);
        }

        .btn-login:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(106, 17, 203, 0.4);
        }

        .btn-login:active {
            transform: translateY(0);
        }

        .signup-link {
            text-align: center;
            margin-top: 25px;
            color: #666;
        }

        .signup-link a {
            color: #6a11cb;
            text-decoration: none;
            font-weight: 600;
            transition: color 0.3s;
        }

        .signup-link a:hover {
            color: #2575fc;
            text-decoration: underline;
        }

        .error-message {
            color: #e74c3c;
            font-size: 14px;
            margin-top: 5px;
            display: none;
        }

        .show-password {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            cursor: pointer;
            color: #777;
        }

        @media (max-width: 480px) {
            .login-container {
                padding: 30px 20px;
            }

            .login-header h1 {
                font-size: 2rem;
            }

            .remember-forgot {
                flex-direction: column;
                align-items: flex-start;
            }

            .forgot-password {
                margin-top: 10px;
            }
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="login-header">
            <h1>欢迎登录</h1>
            <p>请输入您的账号信息</p>
        </div>

        <form id="loginForm" action="/login">
            <div class="input-group">
                <i class="fas fa-user"></i>
                <input type="text" id="username" name="username" placeholder="请输入用户名" required>
                <div class="error-message" id="username-error">用户名不能为空</div>
            </div>

            <div class="input-group">
                <i class="fas fa-lock"></i>
                <input type="password" id="password" name="password" placeholder="请输入密码" required>
                <span class="show-password" id="togglePassword">
                    <i class="fas fa-eye"></i>
                </span>
                <div class="error-message" id="password-error">密码不能为空</div>
            </div>

            <div class="remember-forgot">
                <div class="remember-me">
                    <input type="checkbox" id="remember">
                    <label for="remember">记住我</label>
                </div>
                <a href="#" class="forgot-password">忘记密码?</a>
            </div>

            <button type="submit" class="btn-login">登 录</button>
        </form>

        <div class="signup-link">
            还没有账号? <a href="#">立即注册</a>
        </div>
    </div>

    <script>
        // document.addEventListener('DOMContentLoaded', function() {
        //     const loginForm = document.getElementById('loginForm');
        //     const usernameInput = document.getElementById('username');
        //     const passwordInput = document.getElementById('password');
        //     const usernameError = document.getElementById('username-error');
        //     const passwordError = document.getElementById('password-error');
        //     const togglePassword = document.getElementById('togglePassword');
        //
        //     // 显示/隐藏密码功能
        //     togglePassword.addEventListener('click', function() {
        //         const type = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password';
        //         passwordInput.setAttribute('type', type);
        //         this.innerHTML = type === 'password' ? '<i class="fas fa-eye"></i>' : '<i class="fas fa-eye-slash"></i>';
        //     });
        //
        //     // 表单验证
        //     loginForm.addEventListener('submit', function(e) {
        //         e.preventDefault();
        //         let isValid = true;
        //
        //         // 用户名验证
        //         if (usernameInput.value.trim() === '') {
        //             usernameError.style.display = 'block';
        //             usernameInput.style.borderColor = '#e74c3c';
        //             isValid = false;
        //         } else {
        //             usernameError.style.display = 'none';
        //             usernameInput.style.borderColor = '#e1e1e1';
        //         }
        //
        //         // 密码验证
        //         if (passwordInput.value.trim() === '') {
        //             passwordError.style.display = 'block';
        //             passwordInput.style.borderColor = '#e74c3c';
        //             isValid = false;
        //         } else {
        //             passwordError.style.display = 'none';
        //             passwordInput.style.borderColor = '#e1e1e1';
        //         }
        //
        //         // 如果验证通过，模拟登录
        //         if (isValid) {
        //             // 这里只是模拟登录，实际项目中需要连接后端
        //             alert('登录请求已发送！\n用户名: ' + usernameInput.value + '\n密码: ' + passwordInput.value);
        //
        //             // 在实际项目中，应该将表单数据发送到服务器
        //             // loginForm.submit();
        //         }
        //     });
        //
        //     // 输入时移除错误提示
        //     usernameInput.addEventListener('input', function() {
        //         if (this.value.trim() !== '') {
        //             usernameError.style.display = 'none';
        //             this.style.borderColor = '#e1e1e1';
        //         }
        //     });
        //
        //     passwordInput.addEventListener('input', function() {
        //         if (this.value.trim() !== '') {
        //             passwordError.style.display = 'none';
        //             this.style.borderColor = '#e1e1e1';
        //         }
        //     });
        // });
    </script>
</body>
</html>